import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import java.awt.Dimension;


public class Application {
	static ApplicationPanel panel;

	public static void main(String[] args) {
		JFrame frame = new JFrame("Image Editor");
		frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		myFrameListener listen = new Application.myFrameListener();
		frame.addWindowListener(listen);
		frame.setPreferredSize(new Dimension(550, 600));
		panel = new ApplicationPanel();
		frame.add(panel);
		frame.pack();
		frame.setVisible(true);
	}

	private static class myFrameListener implements WindowListener {
		public void windowActivated(WindowEvent arg0) {
		}

		public void windowClosed(WindowEvent arg0) {
		}

		public void windowClosing(WindowEvent arg0) {
			JFileChooser choose = new JFileChooser();
			panel.close(choose);
		}

		public void windowDeactivated(WindowEvent arg0) {
		}

		public void windowDeiconified(WindowEvent arg0) {
		}

		public void windowIconified(WindowEvent arg0) {
		}

		public void windowOpened(WindowEvent arg0) {
		}

	}
}